<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
    <title>Document</title>
</head>
<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
        <li>7</li>
        <li>8</li>
    </ul>

    <script>
        const lis = document.querySelectorAll("li")

        function enter(e){
            console.log(1);
            this.style.background = "red"
        }
        function leave(e){
            this.style.background = ''
        }

        lis.forEach((item) => {
            item.onmouseenter = _.throttle(enter , 30)
            item.onmouseleave = _.throttle(leave , 30)
        })

    </script>
</body>
</html>